import { useRouter } from "next/router";

const Post = ({ repo }: { repo: string }) => {
  const router = useRouter();

  console.log(repo, "repo");
  const { id } = router.query;

  return (
    <p>
      Post: {id} {repo}
    </p>
  );
};

export default Post;

export const getServerSideProps = async () => {
  const res = await new Promise((resolve) => {
    setTimeout(() => {
      resolve("ssr返回数据");
    }, 3000);
  });
  const repo = res;
  return { props: { repo } };
};
